package top.suven.base.util.createcode;

public class DataDictionaryInfo {

        public DataDictionaryInfo(){

        }
        public DataDictionaryInfo(int columnNum, String columnName, String columnDesc, String columnType, int length, String isNull) {
            this.columnNum = columnNum;
            this.columnName = columnName;
            this.columnDesc = columnDesc;

            this.columnType = columnType;

            this.columnLength = length;
            if(columnLength == -1){
                if(columnType.equalsIgnoreCase("int4")){
                    this.columnLength  = 11;
                }if(columnType.equalsIgnoreCase("timestamp")){
                    this.columnLength = 8;
                }
            }else {
                columnLength = length - 4 < 0 ? 0 : length - 4;
            }
            this.isNull = isNull.equalsIgnoreCase("T")? "Y" :"N";
        }

        private int columnNum;
        private String columnName;
        private String columnType;
        private String columnDesc;
        private int columnLength ;
        private String isNull;

    public int getColumnNum() {
        return columnNum;
    }

    public void setColumnNum(int columnNum) {
        this.columnNum = columnNum;
    }

    public String getColumnName() {
            return columnName;
        }

        public void setColumnName(String columnName) {
            this.columnName = columnName;
        }

        public String getColumnType() {
            return columnType;
        }

        public void setColumnType(String columnType) {
            this.columnType = columnType;
        }

        public String getColumnDesc() {
            return columnDesc;
        }

        public void setColumnDesc(String columnDesc) {
            this.columnDesc = columnDesc;
        }

        public int getColumnLength() {
            return columnLength;
        }

        public void setColumnLength(int columnLength) {
            this.columnLength = columnLength;
        }

    public String getIsNull() {
        return isNull;
    }

    public void setIsNull(String isNull) {
        this.isNull = isNull;
    }
}